import { Theme } from '../interface'
import { setAlphaChannel } from '../utils'

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBar = (theme: Theme, compatibilityMode?: boolean) => ({
  colorBackgroundDark: compatibilityMode
    ? theme.colourway.bar.dark.bg01
    : theme.sys.color.inverseBackgroundBeta,
  colorBackgroundLight: compatibilityMode
    ? theme.colourway.bar.light.bg01
    : theme.sys.color.backgroundAlpha,
  colorBackgroundPrimary: compatibilityMode
    ? theme.colourway.bar.primary.bg01
    : theme.sys.color.primaryAlpha,
  colorBorderShadowDark: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.inverseSeparationMajor,
  colorBorderShadowLight: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.separationMajor,
  colorBorderShadowPrimary: compatibilityMode
    ? theme.colourway.bar.primary.mn04
    : setAlphaChannel(theme.ref.palette.white, theme.ref.alpha.channel35),

  shapeBorderRadiusTopLeftHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRightHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeftHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRightHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  shapeBorderRadiusTopLeftVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRightVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeftVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRightVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarButton = (theme: Theme, compatibilityMode?: boolean) => ({
  colorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.inverseOnBackgroundHigh,
  colorTextDarkDisabled: compatibilityMode
    ? theme.colourway.bar.dark.onBgDisabled
    : theme.sys.color.inverseDisabledHigh,
  colorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  colorTextLightDisabled: compatibilityMode
    ? theme.colourway.bar.light.onBgDisabled
    : theme.sys.color.disabledHigh,
  colorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgHigh
    : theme.sys.color.onPrimaryHigh,
  colorTextPrimaryDisabled: compatibilityMode
    ? theme.colourway.bar.primary.onBgDisabled
    : theme.sys.color.inverseDisabledHigh,
  colorBackgroundDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.inverseOnBackgroundOverlayHover,
  colorBackgroundDarkActive: compatibilityMode
    ? theme.colourway.bar.dark.mn05
    : theme.sys.color.inverseOnBackgroundOverlayActive,
  colorBackgroundLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  colorBackgroundLightActive: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.onBackgroundOverlayActive,
  colorBackgroundPrimaryHover: compatibilityMode
    ? theme.colourway.bar.primary.mn04
    : theme.sys.color.onPrimaryOverlayHover,
  colorBackgroundPrimaryActive: compatibilityMode
    ? theme.colourway.bar.primary.mn05
    : theme.sys.color.onPrimaryOverlayActive,
  colorShadowDarkFocus: compatibilityMode
    ? theme.colourway.bar.dark.focus
    : theme.sys.color.inverseFocus,
  colorShadowLightFocus: compatibilityMode
    ? theme.colourway.bar.light.focus
    : theme.sys.color.focus,
  colorShadowPrimaryFocus: compatibilityMode
    ? theme.colourway.bar.primary.focus
    : theme.sys.color.onPrimaryHigh,

  shapeBorderRadiusTopLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  typographyFontFamily: compatibilityMode
    ? theme.typography.fontFamily.text
    : theme.sys.typography.uiTextMd.fontFamily,
  typographyFontWeight: compatibilityMode
    ? theme.typography.fontWeight.semibold
    : theme.sys.typography.uiTextMd.fontWeight,
  typographyFontSize: compatibilityMode
    ? theme.typography.fontSize.button
    : theme.sys.typography.uiTextMd.fontSize,
  typographyLineHeight: compatibilityMode
    ? theme.typography.lineHeight.button
    : theme.sys.typography.uiTextMd.lineHeight,
  typographyLetterSpacing: compatibilityMode
    ? theme.typography.letterSpacing.button
    : theme.sys.typography.uiTextMd.letterSpacing,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarDate = (theme: Theme, compatibilityMode?: boolean) => ({
  dateColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.inverseOnBackgroundHigh,
  dateColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  dateColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgHigh
    : theme.sys.color.onPrimaryHigh,
  timeColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgLow
    : theme.sys.color.inverseOnBackgroundLow,
  timeColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgLow
    : theme.sys.color.onBackgroundLow,
  timeColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgLow
    : theme.sys.color.onPrimaryLow,

  typographyFontFamily: compatibilityMode
    ? theme.typography.fontFamily.text
    : theme.sys.typography.bodyMd.fontFamily,
  typographyFontWeight: compatibilityMode
    ? theme.typography.fontWeight.regular
    : theme.sys.typography.bodyMd.fontWeight,
  typographyFontSize: compatibilityMode
    ? theme.typography.fontSize.body2
    : theme.sys.typography.bodyMd.fontSize,
  typographyLineHeight: compatibilityMode
    ? theme.typography.lineHeight.body2
    : theme.sys.typography.bodyMd.lineHeight,
  typographyLetterSpacing: compatibilityMode
    ? theme.typography.letterSpacing.body2
    : theme.sys.typography.bodyMd.letterSpacing,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarDivider = (
  theme: Theme,
  compatibilityMode?: boolean
) => ({
  colorBackgroundDarkMajor: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.inverseSeparationMajor,
  colorBackgroundDarkMinor: compatibilityMode
    ? theme.colourway.bar.dark.mn02
    : theme.sys.color.inverseSeparationMinor,
  colorBackgroundLightMajor: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.separationMajor,
  colorBackgroundLightMinor: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.separationMinor,
  colorBackgroundPrimaryMajor: compatibilityMode
    ? theme.colourway.bar.primary.mn04
    : setAlphaChannel(theme.ref.palette.white, theme.ref.alpha.channel35),
  colorBackgroundPrimaryMinor: compatibilityMode
    ? theme.colourway.bar.primary.mn02
    : setAlphaChannel(theme.ref.palette.white, theme.ref.alpha.channel20),
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarDropdown = (
  theme: Theme,
  compatibilityMode?: boolean
) => ({
  listColorBackgroundDark: compatibilityMode
    ? theme.colourway.bar.dark.bg01
    : theme.sys.color.inverseBackgroundAlpha,
  listColorBackgroundLight: compatibilityMode
    ? theme.colourway.bar.light.bg01
    : theme.sys.color.backgroundAlpha,
  listColorBackgroundPrimary: compatibilityMode
    ? theme.colourway.bar.primary.bg01
    : theme.sys.color.backgroundAlpha,
  listColorBorderDark: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.inverseSeparationMajor,
  listColorBorderLight: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.separationMajor,
  listColorBorderPrimary: compatibilityMode
    ? theme.colourway.bar.primary.mn04
    : theme.sys.color.separationMajor,

  listShapeBorderRadiusTopLeftMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,
  listShapeBorderRadiusTopRightMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,
  listShapeBorderRadiusBottomLeftMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,
  listShapeBorderRadiusBottomRightMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,

  listShapeBorderRadiusTopLeftSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,
  listShapeBorderRadiusTopRightSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,
  listShapeBorderRadiusBottomLeftSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,
  listShapeBorderRadiusBottomRightSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,

  listShapeBorderRadiusTopLeftLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,
  listShapeBorderRadiusTopRightLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,
  listShapeBorderRadiusBottomLeftLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,
  listShapeBorderRadiusBottomRightLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarDropdownItem = (
  theme: Theme,
  compatibilityMode?: boolean
) => ({
  colorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.inverseOnBackgroundHigh,
  colorTextDarkDisabled: compatibilityMode
    ? theme.colourway.bar.dark.onBgDisabled
    : theme.sys.color.inverseDisabledHigh,
  colorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  colorTextLightDisabled: compatibilityMode
    ? theme.colourway.bar.light.onBgDisabled
    : theme.sys.color.disabledHigh,
  colorTextPrimary: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  colorTextPrimaryDisabled: compatibilityMode
    ? theme.colourway.bar.light.onBgDisabled
    : theme.sys.color.disabledHigh,
  colorBackgroundDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn02
    : theme.sys.color.inverseOnBackgroundOverlayHover,
  colorBackgroundDarkFocus: compatibilityMode
    ? theme.colourway.bar.dark.mn02
    : theme.sys.color.inverseOnBackgroundOverlayHover,
  colorBackgroundLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  colorBackgroundLightFocus: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  colorBackgroundPrimaryHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  colorBackgroundPrimaryFocus: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  //TODO: удалить в 2.0
  listColorBackgroundDark: '',
  listColorBackgroundLight: '',
  listColorBackgroundPrimary: '',
  listColorBorderDark: '',
  listColorBorderLight: '',
  listColorBorderPrimary: '',

  shapeBorderRadiusTopLeftSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRightSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeftSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRightSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  shapeBorderRadiusTopLeftMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRightMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeftMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRightMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  shapeBorderRadiusTopLeftLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRightLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeftLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRightLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarMenuItem = (
  theme: Theme,
  compatibilityMode?: boolean
) => ({
  colorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgLow
    : theme.sys.color.inverseOnBackgroundLow,
  colorTextDarkDisabled: compatibilityMode
    ? theme.colourway.bar.dark.onBgDisabled
    : theme.sys.color.inverseDisabledHigh,
  colorTextDarkSelected: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.inverseOnBackgroundHigh,
  colorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgLow
    : theme.sys.color.onBackgroundMedium,
  colorTextLightDisabled: compatibilityMode
    ? theme.colourway.bar.light.onBgDisabled
    : theme.sys.color.disabledHigh,
  colorTextLightSelected: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  colorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgLow
    : theme.sys.color.onPrimaryLow,
  colorTextPrimaryDisabled: compatibilityMode
    ? theme.colourway.bar.primary.onBgDisabled
    : theme.sys.color.inverseDisabledHigh,
  colorTextPrimarySelected: compatibilityMode
    ? theme.colourway.bar.primary.onBgHigh
    : theme.sys.color.onPrimaryHigh,
  colorBackgroundDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.inverseOnBackgroundOverlayHover,
  colorBackgroundDarkActive: compatibilityMode
    ? theme.colourway.bar.dark.mn05
    : theme.sys.color.inverseOnBackgroundOverlayActive,
  colorBackgroundDarkSelected: compatibilityMode
    ? theme.colourway.bar.dark.mn02
    : theme.sys.color.inverseOnBackgroundOverlayHover,
  colorBackgroundLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  colorBackgroundLightActive: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.onBackgroundOverlayActive,
  colorBackgroundLightSelected: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : 'transparent',
  colorBackgroundPrimaryHover: compatibilityMode
    ? theme.colourway.bar.primary.mn04
    : theme.sys.color.onPrimaryOverlayHover,
  colorBackgroundPrimaryActive: compatibilityMode
    ? theme.colourway.bar.primary.mn05
    : theme.sys.color.onPrimaryOverlayActive,
  colorBackgroundPrimarySelected: compatibilityMode
    ? theme.colourway.bar.primary.mn02
    : theme.sys.color.onPrimaryOverlayToning,
  indicatorColorBackgroundDark: compatibilityMode
    ? theme.colourway.bar.dark.selector
    : theme.sys.color.inversePrimaryAlpha,
  indicatorColorBackgroundLight: compatibilityMode
    ? theme.colourway.bar.light.selector
    : theme.sys.color.primaryAlpha,
  indicatorColorBackgroundPrimary: compatibilityMode
    ? theme.colourway.bar.primary.selector
    : theme.sys.color.onPrimaryHigh,
  colorShadowDarkFocus: compatibilityMode
    ? theme.colourway.bar.dark.focus
    : theme.sys.color.inverseFocus,
  colorShadowLightFocus: compatibilityMode
    ? theme.colourway.bar.light.focus
    : theme.sys.color.focus,
  colorShadowPrimaryFocus: compatibilityMode
    ? theme.colourway.bar.primary.focus
    : theme.sys.color.onPrimaryHigh,

  shapeBorderRadiusTopLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  typographyFontFamily: compatibilityMode
    ? theme.typography.fontFamily.text
    : theme.sys.typography.titleMd.fontFamily,
  typographyFontWeight: compatibilityMode
    ? theme.typography.fontWeight.regular
    : theme.sys.typography.titleMd.fontWeight,
  typographyFontSize: compatibilityMode
    ? theme.typography.fontSize.subtitle1
    : theme.sys.typography.titleMd.fontSize,
  typographyLineHeight: compatibilityMode
    ? theme.typography.lineHeight.subtitle1
    : theme.sys.typography.titleMd.lineHeight,
  typographyLetterSpacing: compatibilityMode
    ? theme.typography.letterSpacing.subtitle1
    : theme.sys.typography.titleMd.letterSpacing,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarSearch = (theme: Theme, compatibilityMode?: boolean) => ({
  inputColorTextLightDisabled: compatibilityMode
    ? theme.colourway.bar.light.onBgDisabled
    : theme.sys.color.disabledHigh,
  inputColorTextDarkDisabled: compatibilityMode
    ? theme.colourway.bar.dark.onBgDisabled
    : theme.sys.color.inverseDisabledHigh,
  inputColorTextPrimaryDisabled: compatibilityMode
    ? theme.colourway.bar.primary.onBgDisabled
    : theme.sys.color.inverseDisabledHigh,
  inputColorBorderDark: compatibilityMode
    ? theme.colourway.bar.dark.mn05
    : theme.sys.color.inverseSeparationMinor,
  inputColorBorderDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn06
    : theme.sys.color.inverseSeparationMajor,
  inputColorBorderLight: compatibilityMode
    ? theme.colourway.bar.light.mn05
    : theme.sys.color.separationMinor,
  inputColorBorderLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn06
    : theme.sys.color.separationMajor,
  inputColorBorderPrimary: compatibilityMode
    ? theme.colourway.bar.primary.mn05
    : setAlphaChannel(theme.ref.palette.white, theme.ref.alpha.channel20),
  inputColorBorderPrimaryHover: compatibilityMode
    ? theme.colourway.bar.primary.mn06
    : setAlphaChannel(theme.ref.palette.white, theme.ref.alpha.channel35),
  inputColorBackgroundDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn02
    : theme.sys.color.inverseOnBackgroundOverlayHover,
  inputColorBackgroundLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  inputColorBackgroundPrimaryHover: compatibilityMode
    ? theme.colourway.bar.primary.mn02
    : theme.sys.color.onPrimaryOverlayHover,
  inputColorShadowDarkFocus: compatibilityMode
    ? theme.colourway.bar.dark.focus
    : theme.sys.color.inverseFocus,
  inputColorShadowLightFocus: compatibilityMode
    ? theme.colourway.bar.light.focus
    : theme.sys.color.focus,
  inputColorShadowPrimaryFocus: compatibilityMode
    ? theme.colourway.bar.primary.focus
    : theme.sys.color.onPrimaryHigh,
  inputColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.inverseOnBackgroundHigh,
  inputColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  inputColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgHigh
    : theme.sys.color.onPrimaryHigh,
  placeholderColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgLow
    : theme.sys.color.inverseOnBackgroundLow,
  placeholderColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgLow
    : theme.sys.color.onBackgroundLow,
  placeholderColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgLow
    : theme.sys.color.onPrimaryLow,
  prefixColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgLow
    : theme.sys.color.inverseOnBackgroundLow,
  prefixColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgLow
    : theme.sys.color.onBackgroundLow,
  prefixColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgLow
    : theme.sys.color.onPrimaryLow,
  suffixColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.inverseOnBackgroundHigh,
  suffixColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  suffixColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgHigh
    : theme.sys.color.onPrimaryHigh,

  shapeBorderRadiusTopLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createBarSelect = (theme: Theme, compatibilityMode?: boolean) => ({
  colorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.inverseOnBackgroundHigh,
  colorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  colorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgHigh
    : theme.sys.color.onPrimaryHigh,
  placeholderColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgLow
    : theme.sys.color.inverseOnBackgroundLow,
  placeholderColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgLow
    : theme.sys.color.onBackgroundLow,
  placeholderColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.primary.onBgLow
    : theme.sys.color.onPrimaryLow,
  colorBorderDark: compatibilityMode
    ? theme.colourway.bar.dark.mn05
    : theme.sys.color.inverseSeparationMinor,
  colorBorderDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn06
    : theme.sys.color.inverseSeparationMajor,
  colorBorderLight: compatibilityMode
    ? theme.colourway.bar.light.mn05
    : theme.sys.color.separationMinor,
  colorBorderLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn06
    : theme.sys.color.separationMajor,
  colorBorderPrimary: compatibilityMode
    ? theme.colourway.bar.primary.mn05
    : setAlphaChannel(theme.ref.palette.white, theme.ref.alpha.channel20),
  colorBorderPrimaryHover: compatibilityMode
    ? theme.colourway.bar.primary.mn06
    : setAlphaChannel(theme.ref.palette.white, theme.ref.alpha.channel35),
  colorBackgroundDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn02
    : theme.sys.color.inverseOnBackgroundOverlayHover,
  colorBackgroundLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  colorBackgroundPrimaryHover: compatibilityMode
    ? theme.colourway.bar.primary.mn02
    : theme.sys.color.onPrimaryOverlayHover,
  colorShadowDarkFocus: compatibilityMode
    ? theme.colourway.bar.dark.focus
    : theme.sys.color.inverseFocus,
  colorShadowLightFocus: compatibilityMode
    ? theme.colourway.bar.light.focus
    : theme.sys.color.focus,
  colorShadowPrimaryFocus: compatibilityMode
    ? theme.colourway.bar.primary.focus
    : theme.sys.color.onPrimaryHigh,
  listColorBackgroundDark: compatibilityMode
    ? theme.colourway.bar.dark.bg01
    : theme.sys.color.backgroundAlpha,
  listColorBackgroundLight: compatibilityMode
    ? theme.colourway.bar.light.bg01
    : theme.sys.color.backgroundAlpha,
  listColorBackgroundPrimary: compatibilityMode
    ? theme.colourway.bar.light.bg01
    : theme.sys.color.backgroundAlpha,
  listColorBorderDark: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.separationMajor,
  listColorBorderLight: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.separationMajor,
  listColorBorderPrimary: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.separationMajor,
  optionColorTextDark: compatibilityMode
    ? theme.colourway.bar.dark.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  optionColorTextLight: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  optionColorTextPrimary: compatibilityMode
    ? theme.colourway.bar.light.onBgHigh
    : theme.sys.color.onBackgroundHigh,
  optionColorBackgroundDarkHover: compatibilityMode
    ? theme.colourway.bar.dark.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  optionColorBackgroundLightHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,
  optionColorBackgroundPrimaryHover: compatibilityMode
    ? theme.colourway.bar.light.mn02
    : theme.sys.color.onBackgroundOverlayHover,

  inputShapeBorderRadiusTopLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  inputShapeBorderRadiusTopRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  inputShapeBorderRadiusBottomLeft: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  inputShapeBorderRadiusBottomRight: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  listShapeBorderRadiusTopLeftMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,
  listShapeBorderRadiusTopRightMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,
  listShapeBorderRadiusBottomLeftMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,
  listShapeBorderRadiusBottomRightMd: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusMd,

  listShapeBorderRadiusTopLeftSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,
  listShapeBorderRadiusTopRightSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,
  listShapeBorderRadiusBottomLeftSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,
  listShapeBorderRadiusBottomRightSm: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusSm,

  listShapeBorderRadiusTopLeftLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,
  listShapeBorderRadiusTopRightLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,
  listShapeBorderRadiusBottomLeftLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,
  listShapeBorderRadiusBottomRightLg: compatibilityMode
    ? theme.shape.borderRadius
    : theme.sys.shape.borderRadiusLg,

  optionShapeBorderRadiusTopLeftMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusTopRightMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusBottomLeftMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusBottomRightMd: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  optionShapeBorderRadiusTopLeftSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusTopRightSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusBottomLeftSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusBottomRightSm: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  optionShapeBorderRadiusTopLeftLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusTopRightLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusBottomLeftLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  optionShapeBorderRadiusBottomRightLg: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
})

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const createSubBar = (theme: Theme, compatibilityMode?: boolean) => ({
  colorBackgroundDark: compatibilityMode
    ? theme.colourway.bar.dark.subBg02
    : theme.sys.color.inverseBackgroundAlpha,
  colorBackgroundDarker: compatibilityMode
    ? theme.colourway.bar.dark.subBg01
    : theme.sys.color.inverseBackgroundBeta,
  colorBackgroundLight: compatibilityMode
    ? theme.colourway.bar.light.subBg02
    : theme.sys.color.backgroundBeta,
  colorBackgroundLighter: compatibilityMode
    ? theme.colourway.bar.light.subBg01
    : theme.sys.color.backgroundAlpha,
  colorBorderShadowDark: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.inverseSeparationMajor,
  colorBorderShadowDarker: compatibilityMode
    ? theme.colourway.bar.dark.mn04
    : theme.sys.color.inverseSeparationMajor,
  colorBorderShadowLight: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.separationMajor,
  colorBorderShadowLighter: compatibilityMode
    ? theme.colourway.bar.light.mn04
    : theme.sys.color.separationMajor,

  shapeBorderRadiusTopLeftHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRightHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeftHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRightHorizontal: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,

  shapeBorderRadiusTopLeftVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusTopRightVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomLeftVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
  shapeBorderRadiusBottomRightVertical: compatibilityMode
    ? 0
    : theme.sys.shape.borderRadiusNone,
})
